<template>
  <div class="design-form-config">
    <Row label="单据名称">
      <a-input placeholder="请输入单据名称" v-model="subForm.formName"/>
    </Row>
    <Row label="单据KEY">
      <a-input placeholder="请输入单据Key" v-model="subForm.formKey"/>
    </Row>
    <Row label="数据表">
      <a-input placeholder="请输入数据表名称" v-model="subForm.tableName"/>
    </Row>
  </div>
</template>
<script>
import {createProps} from '@/utils';
import {createFormDefinition} from '@/components/hhd/design/FormDesigner/types';
import Row from '@/components/hhd/design/FormDesigner/base/Row.vue';

export default {
  name: 'SubFormConfig',
  components: {Row},
  props: {
    subForm: createProps(Object, createFormDefinition),
  },
  methods: {
    print() {
      let data = JSON.parse(JSON.stringify(this.subForm));
      data.fields.forEach(f => f.exts = JSON.stringify(f.exts));
      data.views.forEach(v => v.templateConfigs = JSON.stringify(v.templateConfigs));
      data.views.forEach(v => v.components = JSON.stringify(v.components));
      data.subForms.forEach(form => {
        form.fields.forEach(f => f.exts = JSON.stringify(f.exts));
      });
      console.log(JSON.stringify(data));
    },
  }
}
</script>
<style>
.design-form-config {
  padding: 10px;
}
</style>